//
//  UIImageView+ABCDynamicWeb.m
//  ABCAppearanceKit_Example
//
//  Created by mac on 2022/9/9.
//  Copyright © 2022 Joe. All rights reserved.
//

#import "UIImageView+ABCDynamicWeb.h"

@implementation UIImageView (ABCDynamicWeb)

- (void)abc_dynamicWebImageWithLightImageUrl:(NSURL *)lightImageUrl
                       lightPlaceholderImage:(UIImage *)lightPlaceholderImage
                                darkImageUrl:(NSURL *)darkImageUrl
                        darkPlaceholderImage:(UIImage *)darkPlaceholderImage
                                     options:(SDWebImageOptions)options {
    [self abc_bindDynamicUpdate:^(ABCAppearanceDynamicStyle dynamicStyle) {
        if (dynamicStyle == ABCAppearanceDynamicStyle_Dark) {
            [self sd_setImageWithURL:darkImageUrl placeholderImage:darkPlaceholderImage options:options];
        } else {
            [self sd_setImageWithURL:lightImageUrl placeholderImage:lightPlaceholderImage options:options];
        }
    }];
}

- (void)abc_dynamicWebImageWithLightImageUrl:(NSURL *)lightImageUrl lightPlaceholderImage:(UIImage *)lightPlaceholderImage darkImageUrl:(NSURL *)darkImageUrl darkPlaceholderImage:(UIImage *)darkPlaceholderImage {
    [self abc_dynamicWebImageWithLightImageUrl:lightImageUrl lightPlaceholderImage:lightPlaceholderImage darkImageUrl:darkImageUrl darkPlaceholderImage:darkPlaceholderImage options:0];
}

@end
